/*
 ============================================================================
 Name        : main_strutture.c
 Author      : 
 Version     : 0.1
 Copyright   : Your copyright notice
 Description : Template Framework CUnit in C, Ansi-style
 ============================================================================
 */


#include "strutture.h"


int main(){
	int scelta;
	coordinate p;
	coordinate q;
	coordinate c;
	coordinate* r;

 do {
	 system("CLS");
	printf("MENU:\n1=coordinate uguali?\n2=stampa coordinate\n3=coordinata somma\n4=coordinata differenza\n5=coordinata prodotto\n0=ESCI\nScelta=");
	scanf("%d",&scelta);
	switch (scelta){
	case 1:
		system("CLS");
		printf("\nCoordinata p.x=");
		scanf("%d",&p.x);
		printf("\nCoordinata p.y=");
		scanf("%d",&p.y);
		printf("\nCoordinata q.x=");
		scanf("%d",&q.x);
		printf("\nCoordinata q.y=");
		scanf("%d",&q.y);

		if (coordinate_cmp(&p,&q)==true)
			printf("\nLe coordinate sono uguali!\n");
		else
			printf("\nLe coordinate sono diverse!\n");
		system("pause");
		break;
	case 2:
		system("CLS");
		printf("\nCoordinata c.x=");
		scanf("%d",&c.x);
		printf("\nCoordinata c.y=");
		scanf("%d",&c.y);
		coordinate_print(&c);
		system("pause");
		break;
	case 3:
		system("CLS");
		printf("\nCoordinata p.x=");
		scanf("%d",&p.x);
		printf("\nCoordinata p.y=");
		scanf("%d",&p.y);
		printf("\nCoordinata q.x=");
		scanf("%d",&q.x);
		printf("\nCoordinata q.y=");
		scanf("%d",&q.y);

		r=coordinate_somma(&p,&q);
		printf("\n\nCoordinata c.x=%d\nCoordinata c.y=%d\n",r->x,r->y);
		system("pause");
		break;
	case 4:
			system("CLS");
			printf("\nCoordinata p.x=");
			scanf("%d",&p.x);
			printf("\nCoordinata p.y=");
			scanf("%d",&p.y);
			printf("\nCoordinata q.x=");
			scanf("%d",&q.x);
			printf("\nCoordinata q.y=");
			scanf("%d",&q.y);

			r=coordinate_diff(&p,&q);
			printf("\n\nCoordinata c.x=%d\nCoordinata c.y=%d\n",r->x,r->y);
			system("pause");
			break;
	case 5:
			system("CLS");
			printf("\nCoordinata p.x=");
			scanf("%d",&p.x);
			printf("\nCoordinata p.y=");
			scanf("%d",&p.y);
			printf("\nCoordinata q.x=");
			scanf("%d",&q.x);
			printf("\nCoordinata q.y=");
			scanf("%d",&q.y);

			r=coordinate_prod(&p,&q);
			printf("\n\nCoordinata c.x=%d\nCoordinata c.y=%d\n",r->x,r->y);
			system("pause");
			break;

	default:
		break;

	}
  }
	while(scelta!=0);

	system("PAUSE");
	return 0;
}

